from typing import List, Optional
from abc import ABC, abstractmethod
from ..factory.abstract import *
from ..ingredient.abstract import *

__all__ = ["Pizza"]

class Pizza(ABC):
    def __init__(self, ingredient_factory: PizzaIngredientFactory):
        self._ingredient_factory = ingredient_factory
        self._name: Optional[str] = None
        self._dough: Optional[Dough] = None
        self._sauce: Optional[Sauce] = None
        self._veggies: List[Veggies] = []
        self._cheese: Optional[Cheese] = None
        self._pepperoni: Optional[Pepperoni] = None
        self._clam: Optional[Clams] = None

    @property
    def name(self):
        return self._name

    @name.setter
    def name(self, value):
        self._name = value

    def __str__(self):
        result = [f"---- {self.name} ----"]
        if self._dough:
            result.append(str(self._dough))
        if self._sauce:
            result.append(str(self._sauce))
        if self._cheese:
            result.append(str(self._cheese))
        if self._veggies:
            result.append(', '.join([str(i) for i in self._veggies]))
        if self._clam:
            result.append(str(self._clam))
        if self._pepperoni:
            result.append(str(self._pepperoni))
        return '\n'.join(result)

    @abstractmethod
    def prepare(self):
        ...

    @staticmethod
    def bake():
        print("Bake for 25 minutes at 350")

    @staticmethod
    def cut():
        print("Cutting the pizza into diagonal slices")

    @staticmethod
    def box():
        print("Place pizza in official PizzaStore box")
